//
//  UIlabel+Extension.swift
//  Weibo
//
//  Created by 付启刚 on 15/12/17.
//  Copyright © 2015年 faq. All rights reserved.
//

import UIKit
extension UILabel{
    convenience init(title:String,color:UIColor,fontSize:CGFloat,margin: CGFloat = 0){
    self.init()
        text = title
        textColor = color
        textAlignment = .Center
        font = UIFont.systemFontOfSize(fontSize)
        numberOfLines = 0
        sizeToFit()
        if margin > 0 {
            //设置最大显示的宽度
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * margin
            textAlignment = .Left
        }

    }
}
